home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 6 / Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso / 016a / love4th.zip / SAVE.DOC < prev    next >
Text File  |  1991-10-01  |  5KB  |  102 lines

  1. Saving the forth system
  2. -----------------------
  3.         To save interactive forth system, simply type:
  4.         SAVE" filename.EXE"
  5.  
  6.         SAVE" is in the TOOLBOX vocabulary (set by DEVELOP).  It will
  7. overwrite any file existing of the same name.
  8.  
  9.         The word APPLICATION" is used to save final applications.
  10. They are saved without heads or vocabulary stack. When re-started in 
  11. memory, the program has all the remaining segments (code, threads, 
  12. data, stack) compressed to the nearest paragraph.  Note that this word 
  13. automatically returns the user to DOS.  Usage:
  14.  
  15.         ALSO UTILITIES
  16.         APPLICATION" filename.EXE"  wordname
  17.  
  18.         The Forth word QUIT (top level word) is redefined to execute
  19. 'wordname' followed by 'BYE'.  In this way a single forth word becomes the
  20. application.  See also startup conditions below.   For example:
  21.  
  22.         APPLICATION" MYPROG.EXE"  PROG-START-WORD
  23.         C>                                      (dos prompt)
  24.  
  25. Allocating additional memory
  26. ----------------------------
  27.         When an exe file is loaded, DOS allocates enough memory for
  28. the program and any additional that is requested in the exe header.
  29. This is done in two stages.  DOS looks at the minimum amount requested
  30. (MINALLOC).  If insufficient memory is available in the system to
  31. satisfy this, DOS aborts with an error message.  If the request is
  32. satisfied, DOS allots up to the maximum amount requested (MAXALLOC).
  33. If this is a very large number, DOS allots all the available memory.
  34.  
  35.         For interactive forth (saved with SAVE") normally just enough
  36. additional memory is allocated to leave room for the expansion of the
  37. segments.  For final applications, additional memory is allocated for
  38. the stacks alone.
  39.  
  40.         This can be increased by the programmer by storing the number
  41. of requested paragraphs into the variables MINHEAP and MAXHEAP.  These
  42. are normally set to 0.  Note that the actual starting segment for this
  43. programmer requested area is returned by the word GET:HEAP .   Note
  44. that if MINHEAP exceeds MAXHEAP, MAXHEAP is set to the value of
  45. MINHEAP.
  46.  
  47. Setting stack sizes
  48. -------------------
  49.         Normally, 4k bytes are allocated for each of the parameter,
  50. return, vocabulary, and local variable stacks.  These sizes can be
  51. changed as required by changing a table in the code segment.  The
  52. address in the code segment of this table is returned by STACKSIZE.
  53.  
  54.         STACKSIZE 0 +       CS:addr of size of parameter stack
  55.         STACKSIZE 2 +       CS:addr of size of return    stack
  56.         STACKSIZE 4 +       CS:addr of size of vocabulary stack
  57.  
  58.         The sum of these sizes must not exceed 64k bytes less the size
  59. of any storage space allocated in the lower portion of the stack
  60. segment (SS:HERE).   The vocabulary stack size is set to 0
  61. automatically by APPLICATION" .  Any changes to this table become
  62. effective on the next start-up of the system.  Note also that in kernel
  63. words, the return stack pointer is sometimes exchanged with the
  64. parameter stack pointer.
  65.  
  66. Conditions on startup
  67. ---------------------
  68. Both target applications and interactive forth:
  69. - BASE set to DECIMAL
  70. - S0 set to address of stack in SS:
  71. - variable ATTRIBUTE set to 7
  72. - DISPLAYADAPT sets variables CRTSEG and CRTPORT for current video card
  73. - a minimum of MINHEAP paragraphs (spec'd on previous save) available
  74.   above GET:HEAP
  75. - zero divide vector ( INT 0 ) pointing to execute ZERO-DIV
  76. - control-break vector pointing to execute BRK-RETN
  77. - if BLOCK words are installed, they are initialized
  78. - source code loading handle stack is initialized
  79. - printer flag is set to 0 (PR-OFF)
  80. - variable WIDTH is set to 31
  81. - variable WARNING is set to true
  82. - the forth system 10 millisecond timer is set for
  83.   the speed of the present CPU
  84. - executes word ONBOOT
  85. - executes ABORT
  86.  
  87. Interactive forth only:
  88. - clears display and prints logo
  89. - sets vocabularies context:  DEVELOP    current: FORTH
  90. - clears V-BODY to ensure no virtual vocabulary
  91. - FIRST returns an address in high memory (VS:), LIMIT returns an address
  92.   404 hex * #BUFF above FIRST
  93. - array TOPS contains highest usable addresses in each segment.
  94.  
  95. Target application only:
  96. - all segments are packed together to the nearest greater segment,
  97.   based on their respective dictionary pointers
  98. - no head segment is present
  99.   ( HS:HERE GET:HS return undefined values)
  100. - FIRST returns address 50 hex above PAD.  LIMIT returns an address
  101.   404 hex * #BUFF above FIRST.
  102. - array TOPS (highest addresses in each segment) is undefined.